package grade;

import static org.junit.Assert.*;
import junit.framework.TestCase;

import org.junit.Test;

public class TestALoGrade extends TestCase{

	public void testConstrucror(){
		GradeRecord g1= new GradeRecord(1, "mmt", 3, 7.0);
		GradeRecord g2= new GradeRecord(2, "ltcb", 4, 5.0);
		GradeRecord g3= new GradeRecord(3, "the duc", 1, 10.0);
		
		ALoGrade a1= new MTGrade();
		ALoGrade a2= new ConsGrade(g1, a1);
		ALoGrade a3= new ConsGrade(g2, a2);
		ALoGrade a4= new ConsGrade( g3, a3);
		
		ScoreBoard s1= new ScoreBoard("phuong", "DH12DT", a4);
		ScoreBoard s2= new ScoreBoard("nam", "CD12TH", a3);
		System.out.println(s1);
		System.out.println(s2);
	}
	public void testHowManyCrecdits(){
		GradeRecord g1= new GradeRecord(1, "mmt", 3, 7.0);
		GradeRecord g2= new GradeRecord(2, "ltcb", 4, 5.0);
		GradeRecord g3= new GradeRecord(3, "the duc", 1, 10.0);
		
		ALoGrade a1= new MTGrade();
		ALoGrade a2= new ConsGrade(g1, a1);
		ALoGrade a3= new ConsGrade(g2, a2);
		ALoGrade a4= new ConsGrade( g3, a3);
		
		ScoreBoard s= new ScoreBoard("phuong", "DH12DT", a4);
		ScoreBoard s2= new ScoreBoard("nam", "CD12TH", a3);
		assertEquals(a1.howManyCredits(), 0);
		assertEquals(a2.howManyCredits(), 3);
		assertEquals(a3.howManyCredits(), 7);
		assertEquals(a4.howManyCredits(), 8);
		
	}
	public void testGardeAverage(){
		GradeRecord g1= new GradeRecord(1, "mmt", 3, 7.0);
		GradeRecord g2= new GradeRecord(2, "ltcb", 4, 5.0);
		GradeRecord g3= new GradeRecord(3, "the duc", 1, 10.0);
		
		ALoGrade a1= new MTGrade();
		ALoGrade a2= new ConsGrade(g1, a1);
		ALoGrade a3= new ConsGrade(g2, a2);
		ALoGrade a4= new ConsGrade( g3, a3);
		
		ScoreBoard s= new ScoreBoard("phuong", "DH12DT", a4);
		assertEquals(a1.gardeAverage(), 0.0);
		assertEquals(a2.gardeAverage(), 7.0,0.1);
		assertEquals(a3.gardeAverage(), 5.8,0.1);
		assertEquals(a4.gardeAverage(),6.3,0.1 );
	}

}
